import 'package:flutter/services.dart';

class ClipboardUtil {

  /// 从剪切板获取文本内容
  static Future<String> getClipboardData() async {
    ClipboardData? data = await Clipboard.getData(Clipboard.kTextPlain);
    return data?.text ?? '';
  }

  /// 设置剪切板内容
  static Future<void> setClipboardData(String data) async {
    ClipboardData clipboardData = ClipboardData(text: data);
    await Clipboard.setData(clipboardData);
  }
}